package com.jushu.storbox.handler;

import android.os.Message;

import com.jushu.storbox.constant.MessageCode;
import com.jushu.storbox.entities.FileFolderInfo;
import com.jushu.storbox.vo.PagedList;

public abstract class ActionFileHandler extends ClientExceptionRelateHandler {
	
	@SuppressWarnings("unchecked")
	@Override
	public void handleMessage(Message msg) {
		switch(msg.what) {
		case MessageCode.LOAD_FILE_LIST:
			handleLoadFileList(msg, (PagedList<FileFolderInfo>) msg.obj);
			break;
		case MessageCode.OPEN_FOLDER:
			handleOpenFolder(msg, (PagedList<FileFolderInfo>) msg.obj);
			break;
		case MessageCode.OPEN_PARENT_FOLDER:
			handleOpenParentFolder(msg, (PagedList<FileFolderInfo>) msg.obj);
			break;
		case MessageCode.DELETE_FILE_SUCCESS:
			handleDeleteItemSuccess(msg, (FileFolderInfo)msg.obj);
			break;
		case MessageCode.RENAME_SUCCESS:
			handleRenameItemSuccess(msg, (FileFolderInfo)msg.obj);
			break;
		 default:
			 super.handleMessage(msg);
		}
	}

	protected void handleRenameItemSuccess(Message msg, FileFolderInfo obj) { }
	protected void handleDeleteItemSuccess(Message msg, FileFolderInfo obj) { }
	protected void handleOpenParentFolder(Message msg, PagedList<FileFolderInfo> obj) { }
	protected void handleOpenFolder(Message msg, PagedList<FileFolderInfo> pagedList) { }
	protected void handleLoadFileList(Message msg, PagedList<FileFolderInfo> pagedList) { }
}
